import layoutHeaderAside from '@/layout/header-aside'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

const meta = { auth: true }

export default {
    path: '/purchase',
    name: 'purchase',
    meta,
    redirect: { name: 'purchase' },
    component: layoutHeaderAside,
    children: (pre => [
        {
          path: 'index',
          name: `${pre}purchase-index`,
          component: _import('purchase/index'),
          meta: {
            ...meta,
            title: '采购订单'
          }
        },
        {
          path: 'add',
          name: `${pre}purchase-add`,
          component: _import('purchase/add'),
          meta: {
              ...meta,
              title: '新建采购订单',
          cache: true,
          }
        },
        {
          path: 'update',
          name: `${pre}purchase-update`,
          component: _import('purchase/update'),
          meta: {
              ...meta,
              title: '编辑采购订单',
          cache: true,
          }
        },
        {
          path: 'audit',
          name: `${pre}purchase-audit`,
          component: _import('purchase/audit'),
          meta: {
              ...meta,
              title: '审核采购订单',
          cache: true,
          }
        },
        {
          path: 'detailList',
          name: `${pre}purchase-detail`,
          component: _import('purchase/detailList'),
          meta: {
            ...meta,
            title: '采购订单明细'
          }
        }
    ])('purchase-')
}
